##############################
#Figure D3: Risk and Idelogy
#Author: Raluca L. Pahontu
##############################

mydata <- read.dta13("shp.dta", convert.factors = FALSE)
mydata$rho=factor(mydata$rho, levels=c(1,2,3))
risk_ideo <- ggplot(mydata, aes(reorder(as.factor(left), -spending_demand), spending_demand, fill=rho))  
risk_ideo +  
  stat_summary(fun.y=mean, 
               geom="bar",
               width=.3,
               position="dodge") +
  stat_summary(fun.data =mean_cl_normal, 
               geom="errorbar",
               width=.1, 
               position=position_dodge(width=.3))  +
  scale_x_discrete(labels= c("Left-Wing", "Right_Wing")) +
  ylab("Average Social Spending (%)") + 
  xlab("Ideology") + 
  scale_fill_manual(labels=c("3", "2", "1"), values=c("grey80", "grey60", "grey40"), name= "Risk Level") + theme_bw() + 
  coord_cartesian(ylim=c(0,.8)) 
ggsave(file="figure_d3.eps")

